import { t } from "ttag";

import type { DependencyGroupType, DependencyNode } from "metabase-types/api";

import { getNodeLabel } from "../../utils";

export function getHeaderLabel(
  node: DependencyNode,
  groupType: DependencyGroupType,
): string {
  const nodeLabel = getNodeLabel(node);

  switch (groupType) {
    case "question":
      return t`Questions that use ${nodeLabel}`;
    case "model":
      return t`Models that use ${nodeLabel}`;
    case "metric":
      return t`Metrics that use ${nodeLabel}`;
    case "table":
      return node.type === "transform"
        ? t`Table generated by ${nodeLabel}`
        : t`Tables that use ${nodeLabel}`;
    case "transform":
      return t`Transforms that use ${nodeLabel}`;
    case "snippet":
      return t`Snippets that use ${nodeLabel}`;
    case "dashboard":
      return t`Dashboards that use ${nodeLabel}`;
    case "document":
      return t`Documents that use ${nodeLabel}`;
    case "sandbox":
      return t`Row and column security rules that use ${nodeLabel}`;
    case "segment":
      return t`Segments that use ${nodeLabel}`;
  }
}
